package com.ldc.commonlibs.common

import com.google.gson.JsonParseException
import com.google.gson.annotations.SerializedName
import okio.IOException
import org.apache.http.conn.ConnectTimeoutException
import org.json.JSONException
import retrofit2.HttpException
import java.net.SocketTimeoutException
import java.net.UnknownHostException

data class RspModel<out T>(
    @SerializedName("errorCode")
    val errorCode: Int = -1,
    @SerializedName("errorMsg")
    val errorMsg: String,
    @SerializedName("data")
    val data: T? = null,
) {
    fun isSuccess(): Boolean {
        return errorCode == CODE_SUCCESS && data != null
    }

    fun isSuccessIgnoreData(): Boolean {
        return errorCode == CODE_SUCCESS
    }

    companion object {
        const val CODE_SUCCESS = 0
    }
}
